import EditableObject from '@/core/editable-object/EditableObject';
import File from '@/core/file-model/File'
import Directory from '@/core/file-model/Directory';
import generateId from '@/core/generateId';
import { Component, Prop } from 'vue-property-decorator';
import FileHandler from './FileHandler';
import ApplicationEditor from '@/components/ApplicationEditor.vue'

/** 应用设置 */
@Component
export default class FileEditableObject extends EditableObject {
  public id = generateId('FileEditableObject');

  @Prop({ required: true })
  public file!: File;

  @Prop({ required: true })
  public parentPath!: string;

  @Prop()
  public appEditor!: ApplicationEditor

  @Prop()
  public parentDirectorys!: Directory[]

  public get displayName() {
    return this.file.name
  }

  public get fileHandler () {
    return new FileHandler({ propsData: { file: this.file, appEditor: this.appEditor }})
  }
}
